<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>父组件向子组件传递多个数据</title>
</head>
<body>
<div id="app">
    <cpn v-bind:name="person.name" v-bind:age="person.age" v-bind:gender="person.gender"></cpn>
</div>

<template id="cpn">
    <h1>姓名：{{ name }}</h1>
    <h1>年龄：{{ age }}</h1>
    <h1>性别：{{ gender }}</h1>
</template>

<script type="module">
    import {createApp, defineComponent, ref} from "../../../js/vue.esm-browser.js";

    // 自定义组件
    let cpn = defineComponent(
        {
            template: "#cpn",
            // 通过 props 选项定义从父组件接收的变量
            props: ['name', 'age', 'gender'],
            setup() {

            }
        }
    );

    let app = createApp(
        {
            setup() {
                let person = ref({
                    name: "abc",
                    age: 18,
                    gender: "M",
                })
                return {person}
            }
        }
    );

    // 注册组件
    app.component("cpn", cpn)

    app.mount("#app")
</script>
</body>
</html>